package com.dingwen.consumer.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * order controller
 *
 * @author dingwen
 * 2021.07.14 13:56
 */
@RestController
@RequestMapping("/consumer")
public class OrderController {

    private final RestTemplate restTemplate;

    private static final String PAYMENT_URL = "http://cloud-provider-payment";

    public OrderController(RestTemplate restTemplate) {
        this.restTemplate = restTemplate;
    }

    /**
     * zookeeper 服务调用测试
     *
     * @return {@link Object}
     */
    @GetMapping("/zookeeper")
    public String find() {
        return restTemplate.getForObject(PAYMENT_URL + "/payment/zookeeper", String.class);
    }
}
